package com.chuangke.file.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.chuangke.file.model.FileInfoDeleted;

/**
 * @Description
 * @author stm
 * @date 2019年2月24日 下午10:04:17
 */
public interface FileInfoDeletedMapper extends BaseMapper<FileInfoDeleted>{

	@Select("select * from file_info_deleted a where not exists(select 1 from file_info b where a.storage1=b.storage1 and a.storage2=b.storage2)")
	List<FileInfoDeleted> selectCanDelete();
	
	@Delete("delete from file_info_deleted where exists(select 1 from file_info where file_info_deleted.storage1=file_info.storage1 and file_info_deleted.storage2=file_info.storage2)")
	int deleteCanDelete();
	
	@Delete("delete from file_info_deleted where not exists(select 1 from file_info where file_info_deleted.storage1=file_info.storage1 and file_info_deleted.storage2=file_info.storage2)")
	int deleteDeleted();
	
}
